"""
    文件打开与关闭
"""
# 打开文件
file = open('file.txt', 'r')

# data = file.read()
# print(data)

# while True:
#     data=file.read(16)
#     if not data:
#         break
#     print(data)

# data=file.readline()
# print(data)
# data=file.readline()
# print(data)

# data = file.readlines(150)
# for item in data:
#     print(item)

for line in file:
    print(line)

# 关闭文件对象
file.close()
